"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RedisManager = void 0;
const RedisConfig_1 = require("../../config/RedisConfig");
const Logger_1 = require("./Logger");
const RedisClient_1 = require("./RedisClient");
class RedisManager {
    constructor() {
        this.redisClientList = [];
    }
    init() {
        for (const key in RedisConfig_1.RedisConfig.Database_Index) {
            if (RedisConfig_1.RedisConfig.Database_Index.hasOwnProperty(key)) {
                const element = RedisConfig_1.RedisConfig.Database_Index[key];
                let redisClient = new RedisClient_1.RedisClient();
                redisClient.init(element);
                this.redisClientList.push(redisClient);
            }
        }
    }
    getRedis(database) {
        for (let i = 0; i < this.redisClientList.length; i++) {
            let redis = this.redisClientList[i];
            if (redis.databaseIndex == database) {
                return redis;
            }
        }
        Logger_1.Logger.error("getRedis error==", database);
    }
}
exports.RedisManager = RedisManager;
RedisManager.instance = new RedisManager();
